use "Table_3_4_rob"

*** TABLE 3 *** 
reghdfe nat_5_fill  eurosceptic   ,  a(nuts y10) vce(cluster  nuts2016)  
outreg2 using Table_3, keep(  eurosceptic  )  nonotes nocons replace   tex addtext(NUTS FE, YES, Year FE, YES, Controls, NO, Country*Year FE, NO)     
reghdfe nat_5_fill  eurosceptic##ib(2).thirdnet  ,  a(nuts y10 ) vce(cluster  nuts2016)  
outreg2 using Table_3, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, NO, Country*Year FE, NO)
reghdfe nat_5_fill  eurosceptic##ib(2).thirdnet  ,  a(nuts y10 c##y10 ) vce(cluster  nuts2016)  
outreg2 using Table_3, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, YES, Country*Year FE, YES)

*** FIGURE 4 ***
twoway (histogram diff, xmtick(-40(5)40, grid) xline(0 , lpattern(dash)) xtitle("DiffEU-Nat") ///
legend(label(1 "Eurosceptic") label(2 "Moderate")) graphregion(color(white)) percent bin(50) lwidth(thick) color(none) ///
lcolor(gs9) color(gs9) , if eurosceptic==1 & diff>-40  )  (histogram diff, percent bin(50) lwidth(thin) color(none) ///
lcolor(black)  color(none)  , if eurosceptic==0  & diff>-40 ) 

 
*** TABLE 4 ***
reghdfe diff  ib(2).thirdnet  ,  a( y10) vce(cluster  nuts2016)
outreg2 using Table_4, keep( 1.thirdnet 3.thirdnet  )  nonotes nocons replace   tex addtext(NUTS FE, NO, Year FE, YES, Turnout Diff., NO, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic   ,  a(nuts y10) vce(cluster  nuts2016)  
outreg2 using Table_4, keep( eurosceptic  )  nonotes nocons   tex addtext(NUTS FE, YES, Year FE, YES, Turnout Diff., NO, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).thirdnet  ,  a(nuts y10) vce(cluster  nuts2016)  
outreg2 using Table_4, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Turnout Diff., NO, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).thirdnet turn_diff,  a(nuts y10 ) vce(cluster  nuts2016)  
outreg2 using Table_4, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet  )  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Turnout Diff., YES, Controls, NO, Country*Year FE, NO)
reghdfe diff  eurosceptic##ib(2).thirdnet##c.turn_diff,  a(nuts y10 ) vce(cluster  nuts2016)  
outreg2 using Table_4, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet  )  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Turnout Diff., YES+INT, Controls, NO, Country*Year FE, NO)
reghdfe diff  eurosceptic##ib(2).thirdnet turn_diff  small winner,  a(nuts y10 c##y10  ) vce(cluster  nuts2016)  
outreg2 using Table_4, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES,  Turnout Diff., YES, Controls, YES, Country*Year FE, YES)
reghdfe diff  eurosceptic##ib(2).thirdnet turn_diff small winner,  a(nuts y10 c##y10  ) vce(cluster  nuts2016) , if mixed ==0 & majori==0 
outreg2 using Table_4, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES,  Turnout Diff., YES, Controls, YES, Country*Year FE, YES)

reghdfe diff  eurosceptic##ib(2).thirdnet turn_diff small winner,  a(nuts y10 c##y10  ) vce(cluster  nuts2016) , if proEU==1  | eurosceptic==1 
outreg2 using Table_4, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES,  Turnout Diff., YES, Controls, YES, Country*Year FE, YES)

reghdfe diff  eurosceptic##ib(2).thirdnet##enlarge1999    turn_diff ,  a(nuts y10 c##y10  ) vce(cluster  nuts2016), if new_c==0
outreg2 using Table_4, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet 1.eurosceptic#1.thirdnet#1.enlarge1999 1.eurosceptic#3.thirdnet#1.enlarge1999)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES,  Turnout Diff., NO, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).thirdnet##enlarge1999  eurosceptic##ib(2).thirdnet##enlarge2004  turn_diff ,  a(nuts y10 c##y10  ) vce(cluster  nuts2016), if new_c==0
outreg2 using Table_4, keep(1.eurosceptic 1.eurosceptic#1.thirdnet 1.eurosceptic#3.thirdnet 1.eurosceptic#1.thirdnet#1.enlarge1999 1.eurosceptic#3.thirdnet#1.enlarge1999 1.eurosceptic#1.thirdnet#1.enlarge2004 1.eurosceptic#3.thirdnet#1.enlarge2004)   nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES,  Turnout Diff., NO, Controls, NO, Country*Year FE, NO)   

 
 


*** TABLE A6 *** 
reghdfe diff  eurosceptic##ib(2).win_lose  ,  a(nuts y10) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.win_lose 1.eurosceptic#3.win_lose)  nonotes nocons replace   tex addtext(NUTS FE, YES, Year FE, YES, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).win_lose turn_diff,  a(nuts y10 ) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.win_lose 1.eurosceptic#3.win_lose)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).win_lose turn_diff small winner,  a(nuts y10 c##y10  ) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.win_lose 1.eurosceptic#3.win_lose)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, YES, Country*Year FE, YES)
reghdfe diff  eurosceptic##ib(2).thirdnet_abs  ,  a(nuts y10) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.thirdnet_abs 1.eurosceptic#3.thirdnet_abs)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).thirdnet_abs turn_diff,  a(nuts y10 ) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.thirdnet_abs 1.eurosceptic#3.thirdnet_abs)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).thirdnet_abs turn_diff small winner,  a(nuts y10 c##y10  ) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.thirdnet_abs 1.eurosceptic#3.thirdnet_abs)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, YES, Country*Year FE, YES)

reghdfe diff  eurosceptic##ib(2).gdp  ,  a(nuts y10) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.gdp 1.eurosceptic#3.gdp)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).gdp turn_diff,  a(nuts y10 ) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.gdp 1.eurosceptic#3.gdp)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, NO, Country*Year FE, NO)   
reghdfe diff  eurosceptic##ib(2).gdp turn_diff small winner,  a(nuts y10 c##y10  ) vce(cluster  nuts2016)  
outreg2 using Table_A6, keep(1.eurosceptic 1.eurosceptic#1.gdp 1.eurosceptic#3.gdp)  nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, YES, Country*Year FE, YES)


*** TABLE A7 (for this part of the data) ***
sutex  diff nat_5_fill eurosceptic  populist farleft farright thirdnet win_lose thirdnet_abs  turn_diff small winner      , lab nobs key(descstat) replace, if diff!=. 
sutex nat_5_fill , lab nobs key(descstat) replace 


*** TABLE A10 ***
reghdfe diff  populist##ib(2).thirdnet turn_diff   small winner  ,  a(nuts y10 c##y10  ) vce(cluster  nuts2016)  
outreg2 using Table_A10, keep(1.populist 1.populist#1.thirdnet 1.populist#3.thirdnet)   nonotes nocons  replace   tex addtext(NUTS FE, YES, Year FE, YES, Controls, YES, Country*Year FE, YES)
reghdfe diff  farleft##ib(2).thirdnet turn_diff   small winner  ,  a(nuts y10 c##y10  ) vce(cluster  nuts2016)  
outreg2 using Table_A10, keep(1.farleft 1.farleft#1.thirdnet 1.farleft#3.thirdnet      )   nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, YES, Country*Year FE, YES)
reghdfe diff  farright##ib(2).thirdnet turn_diff   small winner  ,  a(nuts y10 c##y10  ) vce(cluster  nuts2016)  
outreg2 using Table_A10, keep(1.farright 1.farright#1.thirdnet 1.farright#3.thirdnet      )   nonotes nocons     tex addtext(NUTS FE, YES, Year FE, YES, Controls, YES, Country*Year FE, YES)


*** FIGURE 5 ***

egen IDtime=concat(nuts y10)
egen y= mean(w_diff),by(IDtime), if eurosceptic==1
egen y_mod= mean(w_diff),by(IDtime), if eurosceptic==0

egen Y_eur=max(y),by(IDtime)
egen Y_mod=max(y_mod),by(IDtime)

duplicates drop  IDtime, force


twoway (qfitci Y_eur net ) (scatter Y_eur net    ) ,  name(eur9) 

twoway (qfitci Y_mod net ) (scatter Y_mod net   ) , name(mod9) 

graph combine  eur9 mod9 ,ycommon

*** TABLE A9 ***
reg Y_eur net c.net##c.net , vce(cluster nuts)
	outreg2 using Table_A9, keep(net c.net#c.net) nocons replace tex     

reg Y_mod net c.net##c.net , vce(cluster nuts)
	outreg2 using Table_A9, keep(net c.net#c.net) nocons   tex    
 
